import {
  post,
  postFormData,
  postUpload,
  postFormData2
} from '@/utils/request'
import store from '@/store'

// 上传
export const uploadFile = (file) => postUpload('/common/interface/upload_img', file)

/**
 * 首页
 */
export const http_home = {
  swiper: () => postFormData('/ZlbPage/getCarouselPage'),
  login: (data) => postFormData('/zlb/userManger/login', data)
}
/**
 * 帮办风采
 */
export const http_help = {
  page: (data) => postFormData('/AssistantStyle/getAssistantStyle', data),
  read: (data) => postFormData('/AssistantStyle/getAssistantStyleById', data)
}
/**
 * 帮扶
 */
export const http_help_serve = {
  page: (data) => postFormData('/ProjectEvaluation/getUserHelp', {
    ...data,
    userId: store.getters.userId
  }),
  helpDetail: (data) => postFormData('/ProjectEvaluation/getHelpById', {
    ...data
    // userId: store.getters.userId
  })
}

/**
 * 我的咨询
 */
export const http_consulting = {
  page: (data) => postFormData('/Consulting/getConsulting', {
    ...data,
    userId: store.getters.userId
  }),
  read: (data) => postFormData('/Consulting/getConsultingById', data),
  create: (data) => post('/Consulting/addConsulting', {
    ...data,
    userId: store.getters.userId
  }),
  update: (data) => post('/Consulting/updateConsulting', {
    ...data,
    userId: store.getters.userId
  }),
  del: (id) => post('/Consulting/delConsulting', {
    id,
    isDelete: 0
  })
}

/**
 * 报批指导
 */
export const http_news = {
  page: (data) => postFormData('/ApplicationProcess/getApplicationProcess', {
    ...data
  }),
  problemPage: (data) => postFormData('/ApplicationProcess/getCommonProblem', {
    ...data
  }),
  read: (data) => postFormData('/ApplicationProcess/getApplicationProcessById', {
    ...data
  }),
  problemRead: (data) => postFormData('/ApplicationProcess/getCommonProblemById', {
    ...data
  })
}

/**
 * 数据礼包
 */
export const http_datapackage = {
  page: (data) => postFormData('/ProjectFile/getUserProject', {
    ...data,
    userId: store.getters.userId
  }),
  fileList: (data) => postFormData('/ProjectFile/getProjectFile', {
    ...data,
    userId: store.getters.userId
  })
}

/**
 * 政策推荐
 */
export const http_policy = {
  page: (data) => postFormData('/Policy/getPolicy', {
    ...data,
    userId: store.getters.userId
  }),
  read: (data) => postFormData('/Policy/getPolicyById', data)
}

/**
 * 我的疑问
 */
export const http_problem = {
  page: (data) => postFormData('/UserQuestions/getUserQuestions', {
    ...data,
    userId: store.getters.userId
  }),
  read: (data) => postFormData('/UserQuestions/getUserQuestionsById', data),
  create: (data) => post('/UserQuestions/addUserQuestions', {
    ...data,
    userId: store.getters.userId
  }),
  update: (data) => post('/UserQuestions/updateUserQuestions', {
    ...data,
    userId: store.getters.userId
  }),
  del: (id) => post('/UserQuestions/delUserQuestions', {
    id,
    isDelete: 0
  })
}

/**
 * 我的项目
 */

export const http_project = {
  page: (data) => postFormData('/ProjectEvaluation/getUserProject', {
    ...data,
    userId: store.getters.userId
  }),
  detail: (data) => postFormData('/ZHProject/getDateByid', {
    ...data
  }),
  read: (params) => postFormData('/flowLayout/projectMatters/query', params),
  helpPage: (data) => postFormData('/ProjectEvaluation/getProjectHelp', {
    ...data,
    userId: store.getters.userId
  }),
  helpDetail: (data) => postFormData('/ProjectEvaluation/getHelpById', {
    ...data
  })
}

/**
 * 项目流程
 */
export const http_project_node = {
  // 办理流程
  page: (data) => postFormData('/ProjectEvaluation/getEventById', {
    ...data
  }),
  createLine: (data) => post('/ExternalCommunication/addExternalCommunication', {
    ...data,
    userId: store.getters.userId
  }),
  createPlan: (data) => post('/PlanChange/addPlanChange', {
    ...data,
    userId: store.getters.userId
  }),
  createHelp: (data) => post('/AccurateAssistant/addAccurateAssistant', {
    ...data,
    userId: store.getters.userId
  }),
  read: (productCode) => postFormData('/flowLayout/product/queryDetail', { productCode })
}
/**
 * 用户评价
 */
export const http_evaluation = {
  page: (data) => postFormData('/ProjectEvaluation/getUserComment', {
    ...data,
    userId: store.getters.userId
  }),
  create: (data) => post('/ProjectEvaluation/addProjectcomment', {
    ...data,
    userId: store.getters.userId
  })
}
/**
 * 中介评价
 */
export const http_mediation_evaluation = {
  page: (data) => postFormData('/ZlbIntermediary/getIntermediary', {
    ...data,
    userId: store.getters.userId
  }),
  create: (data) => post('/IntermediaryEvaluation/addIntermediaryEvent', {
    ...data,
    userId: store.getters.userId
  }),
  read: (data) => postFormData('/IntermediaryEvaluation/getIntermediaryEventById', {
    ...data
  })
}

/**
 * 外线联报
 */
export const http_call = {
  page: (data) => postFormData('/ExternalCommunication/addExternalCommunication', {
    ...data,
    userId: store.getters.userId
  }),
  read: (data) => postFormData('/ExternalCommunication/addExternalCommunication', data),
  create: (data) => post('/ExternalCommunication/addExternalCommunication', {
    ...data,
    userId: store.getters.userId
  }),
  update: (data) => post('/ExternalCommunication/addExternalCommunication', {
    ...data,
    userId: store.getters.userId
  }),
  del: (id) => post('/ExternalCommunication/addExternalCommunication', {
    id,
    isDelete: 0
  })
}

/*
 * 掌上中介
 */
export const http_mediation = {
  page: (data) => postFormData('/HandIntermediary/getHandIntermediaryService', {
    ...data
    // userId: store.getters.userId
  }),
  page2: (data) => postFormData('/ZlbIntermediary/getSerInt', {
    ...data
    // userId: store.getters.userId
  }),
  pageList: () => postFormData('/HandIntermediary/getHandIntermediaryCommentNew', {
  }),
  read: (data) => post('/HandIntermediary/getHandIntermediary', {
    ...data,
    userId: store.getters.userId
  }),
  opList: (data) => postFormData('/HandIntermediary/getHandIntermediaryComment', {
    ...data
  }),
  pagered: () => postFormData('/HandIntermediary/getIntermediaryRed', {
  }),
  pageblack: () => postFormData('/HandIntermediary/getHandIntermediaryBlack', {
  }),
  getInterEvent: () => postFormData('/IntermediaryEvaluation/getInterEvent', {
  }),
  getDetail: (data) => postFormData('/HandIntermediary/getHandIntermediaryById', {
    ...data
  })
}

/**
 * 掌上中介
 */
export const http_warning = {
  page: () => postFormData('/ProjectEvaluation/getProjectWarning', {
    userId: store.getters.userId
  })
}

/**
 * 个人中心
 */
export const http_my = {
  page: () => postFormData('/ZlbPage/getUserCenterSum', {
    userId: store.getters.userId
  })
}